﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace MT.Models.Migrations
{
    public partial class db11 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Area",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    ParentAdId = table.Column<int>(nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    Pingyin = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    AdId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Area", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Company",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    SimpleName = table.Column<string>(maxLength: 50, nullable: false),
                    Contacts = table.Column<string>(maxLength: 30, nullable: false),
                    PhoneNumber = table.Column<string>(unicode: false, maxLength: 20, nullable: true),
                    CreateUserId = table.Column<int>(nullable: false),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Company", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Customer",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    MembershipNo = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    Name = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    SexDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    Appellation = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Birthday = table.Column<DateTime>(type: "datetime", nullable: true),
                    NationDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    CardTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    CardId = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Phone = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    Tel = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Email = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    ProvinceId = table.Column<int>(nullable: false),
                    CityId = table.Column<int>(nullable: false),
                    DistrictId = table.Column<int>(nullable: false),
                    Address = table.Column<string>(unicode: false, maxLength: 200, nullable: true),
                    SourceDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Remarks = table.Column<string>(maxLength: 200, nullable: true),
                    StoreId = table.Column<int>(nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    State = table.Column<byte>(nullable: false),
                    CreateUserId = table.Column<int>(nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    Delete = table.Column<bool>(nullable: false),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Members = table.Column<bool>(nullable: true, defaultValueSql: "((0))"),
                    UpdateUserId = table.Column<int>(nullable: true),
                    CounselorId = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Customer", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CustomerExtend",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    CustomerId = table.Column<int>(nullable: false),
                    AnamnesisHistoryDics = table.Column<string>(maxLength: 200, nullable: true),
                    SurgicalHistoryDics = table.Column<string>(maxLength: 200, nullable: true),
                    NonSurgicalHistory = table.Column<string>(maxLength: 500, nullable: true),
                    MedicalBeautyHistory = table.Column<string>(maxLength: 500, nullable: true),
                    AllergyHistoryDics = table.Column<string>(maxLength: 200, nullable: true),
                    DailyNurseHabbit = table.Column<string>(maxLength: 500, nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CustomerExtend", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CustomerFootprint",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Type = table.Column<byte>(nullable: false),
                    CustomerId = table.Column<int>(nullable: false),
                    CustomerName = table.Column<string>(maxLength: 50, nullable: false),
                    GoodsIds = table.Column<string>(maxLength: 100, nullable: true),
                    GoodsName = table.Column<string>(maxLength: 500, nullable: true),
                    RelationUserId = table.Column<int>(nullable: false),
                    SourceId = table.Column<int>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CustomerFootprint", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CustomerGoods",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    CustomerId = table.Column<int>(nullable: false),
                    GoodsId = table.Column<int>(nullable: false),
                    TotalNumber = table.Column<int>(nullable: false),
                    UseNumber = table.Column<int>(nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CustomerGoods", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CustomerGoodsRecord",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    CustomerId = table.Column<int>(nullable: false),
                    StoreId = table.Column<int>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    CreateUserId = table.Column<int>(nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    GoodsId = table.Column<int>(nullable: false),
                    Number = table.Column<int>(nullable: false),
                    NeedConsentImage = table.Column<string>(unicode: false, maxLength: 200, nullable: false),
                    DoctorIds = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    ConsumeChannelType = table.Column<byte>(nullable: false),
                    UseNo = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    ProjectStaffingData = table.Column<string>(maxLength: 500, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CustomerGoodsRecord", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CustomerOrderGoodsRecord",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    CustomerId = table.Column<int>(nullable: false),
                    OrderId = table.Column<int>(nullable: false),
                    GoodsId = table.Column<int>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    Number = table.Column<int>(nullable: false),
                    UseNumber = table.Column<int>(nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true, defaultValueSql: "(getdate())")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CustomerOrderGoodsRecord", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CustomerType",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    Type = table.Column<byte>(nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CustomerType", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Dictionary",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    ParentId = table.Column<int>(nullable: false),
                    Key = table.Column<string>(maxLength: 50, nullable: true),
                    Value = table.Column<string>(maxLength: 50, nullable: true),
                    Description = table.Column<string>(maxLength: 500, nullable: true),
                    Sort = table.Column<int>(nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    IndexKey = table.Column<string>(maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Dictionary", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Goods",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    Type = table.Column<byte>(nullable: false),
                    Barcode = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    CustomCode = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Description = table.Column<string>(nullable: true),
                    DistributionDics = table.Column<string>(unicode: false, maxLength: 100, nullable: false),
                    CategoryId = table.Column<int>(nullable: false),
                    ProjectId = table.Column<int>(nullable: false),
                    UnitId = table.Column<int>(nullable: false),
                    SuggestedPrice = table.Column<long>(nullable: false),
                    MinimumPrice = table.Column<long>(nullable: false),
                    MaximumPrice = table.Column<long>(nullable: false),
                    Images = table.Column<string>(unicode: false, maxLength: 100, nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    EffectiveDays = table.Column<int>(nullable: true, defaultValueSql: "((0))")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Goods", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GoodsCategory",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    ParentId = table.Column<int>(nullable: false),
                    Remarks = table.Column<string>(maxLength: 100, nullable: true),
                    Sort = table.Column<int>(nullable: false),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsCategory", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GoodsCombination",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    CombinationGoodsId = table.Column<int>(nullable: false),
                    ListGoodsId = table.Column<int>(nullable: false),
                    Number = table.Column<int>(nullable: false),
                    SuggestedPrice = table.Column<long>(nullable: false),
                    PackagePrice = table.Column<long>(nullable: false),
                    TotalPackagePrice = table.Column<long>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsCombination", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GoodsSnapshot",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    IsCombination = table.Column<bool>(nullable: false),
                    CategoryId = table.Column<int>(nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    Barcode = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    CustomCode = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    DistributionDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    UnitId = table.Column<int>(nullable: false),
                    SuggestedPrice = table.Column<long>(nullable: false),
                    MinimumPrice = table.Column<long>(nullable: false),
                    MaximumPrice = table.Column<long>(nullable: false),
                    Images = table.Column<string>(unicode: false, maxLength: 100, nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    GoodsId = table.Column<int>(nullable: false),
                    Price = table.Column<long>(nullable: false),
                    Type = table.Column<byte>(nullable: false),
                    GroupId = table.Column<int>(nullable: false),
                    AllowDiscount = table.Column<bool>(nullable: false),
                    MinimumDiscountDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true, defaultValueSql: "((0))"),
                    DistributionTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true, defaultValueSql: "((0))"),
                    StorePrice = table.Column<long>(nullable: false),
                    Version = table.Column<int>(nullable: false),
                    StoreGoodsName = table.Column<string>(maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsSnapshot", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GoodsSnapshotCombination",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    GoodsSnapId = table.Column<int>(nullable: false),
                    ListGoodsId = table.Column<int>(nullable: false),
                    ListGoodsGoodsSnapId = table.Column<int>(nullable: false),
                    Number = table.Column<int>(nullable: false),
                    SuggestedPrice = table.Column<long>(nullable: false),
                    PackagePrice = table.Column<long>(nullable: false),
                    TotalPackagePrice = table.Column<long>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsSnapshotCombination", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Institution",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    ParentId = table.Column<int>(nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    ContactName = table.Column<string>(maxLength: 50, nullable: true),
                    PhoneNumber = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Sort = table.Column<int>(nullable: true),
                    Active = table.Column<bool>(nullable: false),
                    Delete = table.Column<bool>(nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Institution", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MedicalAppointment",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Phone = table.Column<string>(unicode: false, maxLength: 20, nullable: true),
                    Appellation = table.Column<string>(maxLength: 50, nullable: true),
                    CardId = table.Column<string>(maxLength: 50, nullable: true),
                    CardTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Birthday = table.Column<DateTime>(type: "datetime", nullable: true),
                    SexDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    CustomerId = table.Column<int>(nullable: false),
                    CounselorId = table.Column<int>(nullable: false),
                    PurposeDics = table.Column<string>(unicode: false, maxLength: 100, nullable: false),
                    Remarks = table.Column<string>(maxLength: 200, nullable: true),
                    AppointDate = table.Column<DateTime>(type: "datetime", nullable: false),
                    TimeFrameDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    ChannelDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    StoreId = table.Column<int>(nullable: false),
                    StateDic = table.Column<byte>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false),
                    CreateUserId = table.Column<int>(nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    UpdateUserId = table.Column<int>(nullable: true, defaultValueSql: "((0))")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MedicalAppointment", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MedicalCharge",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    CustomerId = table.Column<int>(nullable: false),
                    CounselorId = table.Column<int>(nullable: true, defaultValueSql: "((0))"),
                    StoreId = table.Column<int>(nullable: false),
                    DiscountDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false),
                    CreateUserId = table.Column<int>(nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    UpdateUserId = table.Column<int>(nullable: false),
                    ConsultId = table.Column<int>(nullable: false),
                    Maling = table.Column<long>(nullable: false),
                    SellerId = table.Column<int>(nullable: true),
                    StateDic = table.Column<byte>(nullable: false),
                    SellHandsId = table.Column<int>(nullable: true),
                    IsEraseZero = table.Column<bool>(nullable: false),
                    Remarks = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    ExemptionPrice = table.Column<long>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MedicalCharge", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MedicalChargeDetail",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    MedicalChargeId = table.Column<int>(nullable: false),
                    GoodsId = table.Column<int>(nullable: false),
                    Number = table.Column<int>(nullable: false),
                    GoodsSnapshotId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MedicalChargeDetail", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MedicalConsult",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    StoreRegisterId = table.Column<int>(nullable: false),
                    Content = table.Column<string>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false),
                    CreateUserId = table.Column<int>(nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    UpdateUserId = table.Column<int>(nullable: false),
                    CustomerId = table.Column<int>(nullable: false),
                    CounselorId = table.Column<int>(nullable: false),
                    StateDic = table.Column<byte>(nullable: false),
                    OrderId = table.Column<int>(nullable: true),
                    StoreId = table.Column<int>(nullable: false),
                    VisitTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Diagnosis = table.Column<string>(nullable: true),
                    RecommendTreatmentPlan = table.Column<string>(nullable: true),
                    ManageStateDic = table.Column<byte>(nullable: false),
                    Images = table.Column<string>(unicode: false, maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MedicalConsult", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MedicalRegister",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    VisitTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    CounselorId = table.Column<int>(nullable: true, defaultValueSql: "((0))"),
                    PurposeDics = table.Column<string>(unicode: false, maxLength: 100, nullable: true),
                    RegisterTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    StoreId = table.Column<int>(nullable: true),
                    CustomerId = table.Column<int>(nullable: true, defaultValueSql: "((0))"),
                    StateDic = table.Column<byte>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false),
                    CreateUserId = table.Column<int>(nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    UpdateUserId = table.Column<int>(nullable: false),
                    OrderId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MedicalRegister", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MedicalReturnPlan",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    ReturnPlanRecord = table.Column<string>(maxLength: 500, nullable: true),
                    SatisfactionDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    CustomerId = table.Column<int>(nullable: false),
                    ReturnPlanData = table.Column<int>(nullable: true),
                    PlanReturnPlanTime = table.Column<DateTime>(type: "datetime", nullable: false),
                    ReturnPlanTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    ParentId = table.Column<int>(nullable: true, defaultValueSql: "((0))"),
                    PurposeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    ReturnPlanRemark = table.Column<string>(maxLength: 100, nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    UpdateUserId = table.Column<int>(nullable: true),
                    Number = table.Column<int>(nullable: false),
                    StateDic = table.Column<byte>(nullable: false),
                    ProjectId = table.Column<int>(nullable: false),
                    CustomerConsumeRecordId = table.Column<int>(nullable: true),
                    GoodsId = table.Column<int>(nullable: false),
                    StoreId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MedicalReturnPlan", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MedicalTreatment",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    MedicalRecord = table.Column<string>(maxLength: 500, nullable: true),
                    DoctorId = table.Column<int>(nullable: false),
                    StoreId = table.Column<int>(nullable: false),
                    MedicalTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    CustomerId = table.Column<int>(nullable: true),
                    GoodsId = table.Column<int>(nullable: false),
                    GoodsSnapshotId = table.Column<int>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    StateDic = table.Column<byte>(nullable: false),
                    CustomerConsumeRecordId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MedicalTreatment", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MembershipNoData",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    IsUse = table.Column<bool>(nullable: false),
                    Prefix = table.Column<string>(unicode: false, maxLength: 20, nullable: true),
                    Number = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false),
                    UseTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    StoreId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MembershipNoData", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Menu",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    ParentId = table.Column<int>(nullable: false),
                    Type = table.Column<byte>(nullable: false),
                    PageId = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Icon = table.Column<string>(unicode: false, maxLength: 200, nullable: true),
                    ClientTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    Show = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    PageTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Menu", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "PayMethod",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    PayTypeId = table.Column<int>(nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    Sort = table.Column<int>(nullable: false),
                    Description = table.Column<string>(maxLength: 200, nullable: true),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    UpdateTime = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PayMethod", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "PayType",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    Sort = table.Column<int>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    Description = table.Column<string>(maxLength: 200, nullable: true),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    UpdateTime = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PayType", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Permission",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    MenuId = table.Column<int>(nullable: false),
                    GroupType = table.Column<byte>(nullable: false),
                    FuncPermissionDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false, defaultValueSql: "((0))"),
                    PageId = table.Column<string>(maxLength: 50, nullable: true),
                    Icon = table.Column<string>(unicode: false, maxLength: 200, nullable: false),
                    ControllerAction = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Permission", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Project",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    Description = table.Column<string>(maxLength: 200, nullable: true),
                    Sort = table.Column<int>(nullable: false),
                    TypeDic = table.Column<string>(unicode: false, maxLength: 20, nullable: false, defaultValueSql: "((0))"),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    NeedConsentDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false, defaultValueSql: "((0))"),
                    NeedReturn = table.Column<bool>(nullable: false),
                    Delete = table.Column<bool>(nullable: false),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Project", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ProjectConfig",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    ProjectId = table.Column<int>(nullable: false),
                    BusinessRoleDics = table.Column<string>(unicode: false, maxLength: 100, nullable: false, defaultValueSql: "((0))"),
                    PersonTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false, defaultValueSql: "((0))"),
                    Required = table.Column<bool>(nullable: false),
                    Sort = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProjectConfig", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ProjectReturnPlan",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Number = table.Column<int>(nullable: false),
                    DaysApart = table.Column<int>(nullable: false),
                    ReturnTarget = table.Column<string>(maxLength: 50, nullable: true),
                    BusinessRoleDics = table.Column<string>(unicode: false, maxLength: 100, nullable: true),
                    ProjectId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProjectReturnPlan", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Role",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    Note = table.Column<string>(maxLength: 50, nullable: true),
                    Sort = table.Column<int>(nullable: false),
                    DataPemissionDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false, defaultValueSql: "((0))"),
                    Active = table.Column<bool>(nullable: false),
                    Delete = table.Column<bool>(nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Role", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "RolePermission",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    RoleId = table.Column<int>(nullable: false),
                    PermissionId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RolePermission", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Session",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    InstitutionId = table.Column<int>(nullable: false),
                    ClientTypeDic = table.Column<string>(unicode: false, maxLength: 20, nullable: false),
                    UserId = table.Column<int>(nullable: false),
                    SessionKey = table.Column<string>(unicode: false, maxLength: 64, nullable: false),
                    ExpireTime = table.Column<DateTime>(type: "datetime", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    Delete = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Session", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Store",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    SimpleName = table.Column<string>(maxLength: 50, nullable: true),
                    ProvinceId = table.Column<int>(nullable: false),
                    CityId = table.Column<int>(nullable: false),
                    DistrictId = table.Column<int>(nullable: false),
                    StoreLevelId = table.Column<int>(nullable: false),
                    Address = table.Column<string>(maxLength: 200, nullable: true),
                    CreateUserId = table.Column<int>(nullable: false),
                    PhoneNumber = table.Column<string>(unicode: false, maxLength: 20, nullable: true),
                    InstitutionId = table.Column<int>(nullable: false),
                    Remarks = table.Column<string>(maxLength: 100, nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    BusinessStartTime = table.Column<int>(nullable: true),
                    BusinessEndTime = table.Column<int>(nullable: true),
                    Location = table.Column<string>(unicode: false, maxLength: 30, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Store", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreFinance",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    StoreId = table.Column<int>(nullable: false),
                    TaxIdentifyNumber = table.Column<string>(maxLength: 50, nullable: true),
                    BankAccount = table.Column<string>(maxLength: 50, nullable: true),
                    OpeningBank = table.Column<string>(maxLength: 50, nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreFinance", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreGoods",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    GoodsId = table.Column<int>(nullable: false),
                    Price = table.Column<long>(nullable: false),
                    Type = table.Column<byte>(nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    AllowDiscount = table.Column<bool>(nullable: false),
                    MinimumDiscountDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false, defaultValueSql: "((0))"),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    Version = table.Column<int>(nullable: false),
                    State = table.Column<byte>(nullable: false),
                    DistributionTypeDic = table.Column<string>(maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreGoods", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreGoodsDistributionByArea",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    ProvinceId = table.Column<int>(nullable: false),
                    CityId = table.Column<int>(nullable: false),
                    DistrictId = table.Column<int>(nullable: false),
                    StoreLevelId = table.Column<int>(nullable: false),
                    Price = table.Column<long>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false),
                    StoreGoodsId = table.Column<int>(nullable: false),
                    Sort = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreGoodsDistributionByArea", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreGoodsDistributionByStore",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    StoreId = table.Column<int>(nullable: false),
                    Price = table.Column<long>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    StoreGoodsId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreGoodsDistributionByStore", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreGoodsGroup",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    ParentId = table.Column<int>(nullable: false),
                    Remarks = table.Column<string>(maxLength: 100, nullable: true),
                    Sort = table.Column<int>(nullable: false),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    Icon = table.Column<string>(maxLength: 200, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreGoodsGroup", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreGoodsGroupGoods",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    GroupId = table.Column<int>(nullable: false),
                    StoreGoodsId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreGoodsGroupGoods", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreLevel",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    Remarks = table.Column<string>(maxLength: 100, nullable: true),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    Sort = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreLevel", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreOrder",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    OrderNo = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    StoreId = table.Column<int>(nullable: false),
                    Price = table.Column<long>(nullable: false),
                    OriginalPrice = table.Column<long>(nullable: true),
                    TotalPrice = table.Column<long>(nullable: false),
                    DiscountPrice = table.Column<long>(nullable: false),
                    CustomerId = table.Column<int>(nullable: false),
                    StateDic = table.Column<byte>(nullable: false),
                    CustomerName = table.Column<string>(maxLength: 50, nullable: true),
                    Name = table.Column<string>(unicode: false, maxLength: 200, nullable: true),
                    CreateUserId = table.Column<int>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    UpdateUserId = table.Column<int>(nullable: false),
                    SourceType = table.Column<byte>(nullable: false),
                    SourceId = table.Column<int>(nullable: false),
                    Discount = table.Column<int>(nullable: false),
                    ExemptionPrice = table.Column<long>(nullable: true),
                    CounselorId = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreOrder", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreOrderDetail",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    OrderId = table.Column<int>(nullable: false),
                    GoodsSnapshotId = table.Column<int>(nullable: false),
                    Price = table.Column<long>(nullable: false),
                    DiscountPrice = table.Column<long>(nullable: false),
                    Quantity = table.Column<int>(nullable: false),
                    GoodsId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreOrderDetail", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreOrderPayment",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    OrderId = table.Column<int>(nullable: false),
                    PayNo = table.Column<string>(maxLength: 50, nullable: true),
                    PayTypeId = table.Column<int>(nullable: false),
                    PayMethodId = table.Column<int>(nullable: false),
                    PayPrice = table.Column<long>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    PayTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    RefundTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    CustomerId = table.Column<int>(nullable: false),
                    State = table.Column<byte>(nullable: false),
                    StoreId = table.Column<int>(nullable: false),
                    Delete = table.Column<bool>(nullable: false),
                    CounselorId = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreOrderPayment", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreRefund",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    StateDic = table.Column<byte>(nullable: false),
                    ProcessInstanceId = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    CreateUserId = table.Column<int>(nullable: false),
                    CounselorId = table.Column<int>(nullable: false),
                    OrderId = table.Column<int>(nullable: false),
                    CustomerId = table.Column<int>(nullable: false),
                    RdfunTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    Price = table.Column<long>(nullable: false),
                    RefundNo = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    StoreId = table.Column<int>(nullable: false),
                    RefundTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    CancelTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    TaxIdentifyNumber = table.Column<string>(maxLength: 50, nullable: true),
                    BankAccount = table.Column<string>(maxLength: 50, nullable: true),
                    OpeningBank = table.Column<string>(maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreRefund", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreRefundDetail",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreRefundDetail", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreRefundFlowRecord",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    StoreRefundId = table.Column<int>(nullable: false),
                    StoreRefundFlowId = table.Column<int>(nullable: false),
                    Order = table.Column<int>(nullable: false),
                    IsAudit = table.Column<bool>(nullable: true),
                    Reason = table.Column<string>(maxLength: 50, nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    AuditTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    StoreId = table.Column<int>(nullable: false),
                    AuditUserId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreRefundFlowRecord", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreRefundPayment",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    RefundId = table.Column<int>(nullable: false),
                    StoreId = table.Column<int>(nullable: false),
                    CustomerId = table.Column<int>(nullable: false),
                    Type = table.Column<byte>(nullable: false),
                    CounselorId = table.Column<int>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false),
                    Price = table.Column<long>(nullable: false),
                    StateDic = table.Column<byte>(nullable: false),
                    CustomerFootprintId = table.Column<int>(nullable: false),
                    PayTypeId = table.Column<int>(nullable: true),
                    PayMethodId = table.Column<int>(nullable: true),
                    PayNo = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    State = table.Column<byte>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreRefundPayment", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreSalesStrategyByDiscount",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    StoreLevelId = table.Column<int>(nullable: true),
                    DiscountDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false, defaultValueSql: "((0))"),
                    Quantity = table.Column<int>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    Sort = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreSalesStrategyByDiscount", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreSignInRecord",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    Phone = table.Column<string>(unicode: false, maxLength: 20, nullable: true),
                    StoreName = table.Column<string>(maxLength: 50, nullable: true),
                    StoreId = table.Column<int>(nullable: false),
                    BusinessRoleDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    SignUserId = table.Column<int>(nullable: false),
                    SignDate = table.Column<string>(unicode: false, maxLength: 20, nullable: false),
                    SignTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    CreateUserId = table.Column<int>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false),
                    Location = table.Column<string>(unicode: false, maxLength: 30, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreSignInRecord", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Unit",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    Description = table.Column<string>(maxLength: 50, nullable: true),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Sort = table.Column<int>(nullable: false),
                    Delete = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Unit", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "User",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    UserName = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    PhoneNumber = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    Email = table.Column<string>(unicode: false, maxLength: 25, nullable: true),
                    Note = table.Column<string>(maxLength: 200, nullable: true),
                    SexDic = table.Column<string>(unicode: false, maxLength: 20, nullable: true),
                    Birthday = table.Column<DateTime>(type: "datetime", nullable: true),
                    CardId = table.Column<string>(unicode: false, maxLength: 50, nullable: true, defaultValueSql: "((0))"),
                    CardTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true, defaultValueSql: "((0))"),
                    PasswordHash = table.Column<string>(unicode: false, maxLength: 128, nullable: false),
                    PasswordSalt = table.Column<int>(nullable: false),
                    NationDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Active = table.Column<bool>(nullable: false, defaultValueSql: "((1))"),
                    Delete = table.Column<bool>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    ExpireTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    ExpireTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    ClientTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    DingDingUserId = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    DingDingUnionid = table.Column<string>(unicode: false, maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_User", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "UserBusinessRole",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    UserId = table.Column<int>(nullable: false),
                    BusinessRoleDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    InstitutionId = table.Column<int>(nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserBusinessRole", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "UserInstitution",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    UserId = table.Column<int>(nullable: false),
                    InstitutionId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserInstitution", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "UserLoginLog",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    InstitutionId = table.Column<int>(nullable: false),
                    UserId = table.Column<int>(nullable: false),
                    Conent = table.Column<string>(maxLength: 200, nullable: true),
                    IP = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    ClientTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false, defaultValueSql: "((0))"),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    Delete = table.Column<bool>(nullable: false),
                    Nation = table.Column<string>(maxLength: 20, nullable: true),
                    Province = table.Column<string>(maxLength: 20, nullable: true),
                    City = table.Column<string>(maxLength: 20, nullable: true),
                    District = table.Column<string>(maxLength: 20, nullable: true),
                    Adcode = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserLoginLog", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "UserOperateLog",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    InstitutionId = table.Column<int>(nullable: false),
                    UserId = table.Column<int>(nullable: false),
                    IP = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    ClientTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false, defaultValueSql: "((0))"),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    ModelType = table.Column<byte>(nullable: true),
                    OperateContent = table.Column<string>(maxLength: 100, nullable: true),
                    Type = table.Column<byte>(nullable: true),
                    OperateIds = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    Delete = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserOperateLog", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "UserRole",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    UserId = table.Column<int>(nullable: false),
                    RoleId = table.Column<int>(nullable: false),
                    AuthRoleTypeDic = table.Column<string>(unicode: false, maxLength: 50, nullable: false, defaultValueSql: "((0))"),
                    InstitutionId = table.Column<int>(nullable: true, defaultValueSql: "((0))"),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserRole", x => x.Id);
                });

            migrationBuilder.CreateIndex(
                name: "adId",
                table: "Area",
                column: "AdId",
                unique: true);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Area");

            migrationBuilder.DropTable(
                name: "Company");

            migrationBuilder.DropTable(
                name: "Customer");

            migrationBuilder.DropTable(
                name: "CustomerExtend");

            migrationBuilder.DropTable(
                name: "CustomerFootprint");

            migrationBuilder.DropTable(
                name: "CustomerGoods");

            migrationBuilder.DropTable(
                name: "CustomerGoodsRecord");

            migrationBuilder.DropTable(
                name: "CustomerOrderGoodsRecord");

            migrationBuilder.DropTable(
                name: "CustomerType");

            migrationBuilder.DropTable(
                name: "Dictionary");

            migrationBuilder.DropTable(
                name: "Goods");

            migrationBuilder.DropTable(
                name: "GoodsCategory");

            migrationBuilder.DropTable(
                name: "GoodsCombination");

            migrationBuilder.DropTable(
                name: "GoodsSnapshot");

            migrationBuilder.DropTable(
                name: "GoodsSnapshotCombination");

            migrationBuilder.DropTable(
                name: "Institution");

            migrationBuilder.DropTable(
                name: "MedicalAppointment");

            migrationBuilder.DropTable(
                name: "MedicalCharge");

            migrationBuilder.DropTable(
                name: "MedicalChargeDetail");

            migrationBuilder.DropTable(
                name: "MedicalConsult");

            migrationBuilder.DropTable(
                name: "MedicalRegister");

            migrationBuilder.DropTable(
                name: "MedicalReturnPlan");

            migrationBuilder.DropTable(
                name: "MedicalTreatment");

            migrationBuilder.DropTable(
                name: "MembershipNoData");

            migrationBuilder.DropTable(
                name: "Menu");

            migrationBuilder.DropTable(
                name: "PayMethod");

            migrationBuilder.DropTable(
                name: "PayType");

            migrationBuilder.DropTable(
                name: "Permission");

            migrationBuilder.DropTable(
                name: "Project");

            migrationBuilder.DropTable(
                name: "ProjectConfig");

            migrationBuilder.DropTable(
                name: "ProjectReturnPlan");

            migrationBuilder.DropTable(
                name: "Role");

            migrationBuilder.DropTable(
                name: "RolePermission");

            migrationBuilder.DropTable(
                name: "Session");

            migrationBuilder.DropTable(
                name: "Store");

            migrationBuilder.DropTable(
                name: "StoreFinance");

            migrationBuilder.DropTable(
                name: "StoreGoods");

            migrationBuilder.DropTable(
                name: "StoreGoodsDistributionByArea");

            migrationBuilder.DropTable(
                name: "StoreGoodsDistributionByStore");

            migrationBuilder.DropTable(
                name: "StoreGoodsGroup");

            migrationBuilder.DropTable(
                name: "StoreGoodsGroupGoods");

            migrationBuilder.DropTable(
                name: "StoreLevel");

            migrationBuilder.DropTable(
                name: "StoreOrder");

            migrationBuilder.DropTable(
                name: "StoreOrderDetail");

            migrationBuilder.DropTable(
                name: "StoreOrderPayment");

            migrationBuilder.DropTable(
                name: "StoreRefund");

            migrationBuilder.DropTable(
                name: "StoreRefundDetail");

            migrationBuilder.DropTable(
                name: "StoreRefundFlowRecord");

            migrationBuilder.DropTable(
                name: "StoreRefundPayment");

            migrationBuilder.DropTable(
                name: "StoreSalesStrategyByDiscount");

            migrationBuilder.DropTable(
                name: "StoreSignInRecord");

            migrationBuilder.DropTable(
                name: "Unit");

            migrationBuilder.DropTable(
                name: "User");

            migrationBuilder.DropTable(
                name: "UserBusinessRole");

            migrationBuilder.DropTable(
                name: "UserInstitution");

            migrationBuilder.DropTable(
                name: "UserLoginLog");

            migrationBuilder.DropTable(
                name: "UserOperateLog");

            migrationBuilder.DropTable(
                name: "UserRole");
        }
    }
}
